<?php

namespace iBrand\Shop\Backend\Http\Controllers;

use Encore\Admin\Facades\Admin as LaravelAdmin;
use Encore\Admin\Layout\Content;
use iBrand\Component\Goods\Models\Season;
use iBrand\Component\Goods\Models\Style;
use iBrand\Shop\Backend\Service\CommonService;

class AllotReportController extends Controller
{
	protected $commonService;

	public function __construct(CommonService $commonService)
	{
		$this->commonService = $commonService;
	}

	/**
	 * 调拨报表
	 *
	 * @return \Encore\Admin\Layout\Content
	 */
	public function index()
	{
		$brandList     = $this->commonService->getBrandList();
		$years         = $this->commonService->getYearList();
		$categoryList  = $this->commonService->getCategoryList();
		$clerks        = $this->commonService->getClerkList();
		$specList      = $this->commonService->getSpecList();
		$categories    = $categoryList['categories'];
		$allCategories = $categoryList['allCategories'];
		$seasons       = Season::all()->toArray();
		$styles        = Style::all()->toArray();
		$colors        = $specList['colors'];
		$sizes         = $specList['sizes'];

		return LaravelAdmin::content(function (Content $content) use ($brandList, $years, $clerks, $categories, $allCategories, $seasons, $styles, $colors, $sizes) {

			$content->header('调拨报表');

			$content->breadcrumb(
				['text' => '报表', 'url' => 'warehouse/report/purchase', 'no-pjax' => 1],
				['text' => '调拨报表', 'url' => '', 'no-pjax' => 1, 'left-menu-active' => '调拨报表']

			);

			$content->body(view('shop-backend::allot.index', compact('brandList', 'years', 'clerks', 'categories', 'allCategories', 'seasons', 'styles', 'colors', 'sizes')));
		});
	}

	public function transfersRecordDetailList()
	{
		return $this->ajaxJson();
	}

	public function transfersRecordList()
	{
		return $this->ajaxJson();
	}

	public function transfersGoodsList()
	{
		return $this->ajaxJson();
	}

	public function transfersStorehouseList()
	{
		return $this->ajaxJson();
	}

	public function ransfersRecordDetailListSum()
	{
		return response()->json(['goodsTransferCount' => 0, 'inStoreHouse' => 0, 'outStoreHouse' => 0, 'transferAllNumber' => 0, 'transferAmountMoney' => 0, 'transferCount' => 0,]);
	}
}